home *** CD-ROM | disk | FTP | other *** search
/ 3D Games - Real-time Rend…ng & Software Technology / 3D Games - Real-time Rendering & Software Technology.iso / flysdk / util / max / landscape / landscape.cpp next >
Encoding:
C/C++ Source or Header  |  1999-10-18  |  14.2 KB  |  641 lines

  1. #include "landscape.h"
  2.  
  3. ClassDesc* GetlandscapeDesc();
  4.  
  5. HINSTANCE hInstance;
  6. int controlsInit = FALSE;
  7.  
  8. BOOL WINAPI DllMain(HINSTANCE hinstDLL,ULONG fdwReason,LPVOID lpvReserved)
  9. {
  10.     hInstance = hinstDLL;                // Hang on to this DLL's instance handle.
  11.  
  12.     if (!controlsInit) {
  13.         controlsInit = TRUE;
  14.         InitCustomControls(hInstance);    // Initialize MAX's custom controls
  15.         InitCommonControls();            // Initialize Win95 controls
  16.     }
  17.             
  18.     return (TRUE);
  19. }
  20.  
  21. __declspec( dllexport ) const TCHAR* LibDescription()
  22. {
  23.     return GetString(IDS_LIBDESCRIPTION);
  24. }
  25.  
  26. //TODO: Must change this number when adding a new class
  27. __declspec( dllexport ) int LibNumberClasses()
  28. {
  29.     return 1;
  30. }
  31.  
  32. __declspec( dllexport ) ClassDesc* LibClassDesc(int i)
  33. {
  34.     switch(i) {
  35.         case 0: return GetlandscapeDesc();
  36.         default: return 0;
  37.     }
  38. }
  39.  
  40. __declspec( dllexport ) ULONG LibVersion()
  41. {
  42.     return VERSION_3DSMAX;
  43. }
  44.  
  45. TCHAR *GetString(int id)
  46. {
  47.     static TCHAR buf[256];
  48.     if (hInstance)
  49.         return LoadString(hInstance, id, buf, sizeof(buf)) ? buf : NULL;
  50.     return NULL;
  51. }
  52.  
  53. class landscapeClassDesc:public ClassDesc {
  54.     public:
  55.     int             IsPublic() {return 1;}
  56.     void *            Create(BOOL loading = FALSE) {return new landscape();}
  57.     const TCHAR *    ClassName() {return GetString(IDS_CLASS_NAME);}
  58.     SClass_ID        SuperClassID() {return GEOMOBJECT_CLASS_ID;}
  59.     Class_ID        ClassID() {return LANDSCAPE_CLASS_ID;}
  60.     const TCHAR*     Category() {return GetString(IDS_CATEGORY);}
  61.     void            ResetClassParams (BOOL fileReset);
  62. };
  63.  
  64. static landscapeClassDesc landscapeDesc;
  65. ClassDesc* GetlandscapeDesc() {return &landscapeDesc;}
  66.  
  67. void landscapeClassDesc::ResetClassParams (BOOL fileReset) 
  68. {
  69. }
  70.  
  71. //TODO: Add Parameter block indices for various parameters
  72. #define PB_SIZE                0
  73. #define PB_SEGX                1
  74. #define PB_SEGY                2
  75. #define PB_DISPLACEVALUE    3
  76. #define PB_MAPCOORD            4
  77. #define PB_MAPCOORDTILE        5
  78. #define PB_COLORZGRAD        6
  79.  
  80. //TODO: Add ParamUIDesc's for the various parameters
  81. static ParamUIDesc descParam[] = {
  82.     ParamUIDesc(
  83.         PB_SIZE,
  84.         EDITTYPE_FLOAT,
  85.         IDC_SIZE0,IDC_SIZE0SPIN,
  86.         1.0f,100000.0f,
  87.         1.0f),    
  88.     ParamUIDesc(
  89.         PB_SEGX,
  90.         EDITTYPE_INT,
  91.         IDC_SEGX,IDC_SEGXSPIN,
  92.         1,100000,
  93.         1),    
  94.     ParamUIDesc(
  95.         PB_SEGY,
  96.         EDITTYPE_INT,
  97.         IDC_SEGY,IDC_SEGYSPIN,
  98.         1,100000,
  99.         1),    
  100.     ParamUIDesc(
  101.         PB_DISPLACEVALUE,
  102.         EDITTYPE_FLOAT,
  103.         IDC_DISPLACEVALUE,IDC_DISPLACEVALUESPIN,
  104.         1.0f,10000.0f,
  105.         1.0f),    
  106.     ParamUIDesc(
  107.         PB_MAPCOORD,
  108.         TYPE_SINGLECHEKBOX,
  109.         IDC_MAPCOORD),    
  110.     ParamUIDesc(
  111.         PB_MAPCOORDTILE,
  112.         EDITTYPE_FLOAT,
  113.         IDC_MAPPINGTILE,IDC_MAPPINGTILESPIN,
  114.         1.0f,100.0f,
  115.         1.0f),    
  116.     ParamUIDesc(
  117.         PB_COLORZGRAD,
  118.         TYPE_SINGLECHEKBOX,
  119.         IDC_COLORZGRAD),    
  120.     };     
  121.  
  122. //TODO: Parameter descriptor length
  123. #define PARAMDESC_LENGTH 7
  124.  
  125. //TODO: Add ParamBlockDescID's for the various parameters
  126. static ParamBlockDescID descVer1[] = {
  127.     { TYPE_FLOAT, NULL, TRUE, 0 },
  128.     { TYPE_INT, NULL, TRUE, 0 },
  129.     { TYPE_INT, NULL, TRUE, 0 },
  130.     { TYPE_FLOAT, NULL, TRUE, 0 },
  131.     { TYPE_BOOL, NULL, TRUE, 0 },
  132.     { TYPE_FLOAT, NULL, TRUE, 0 },
  133.     { TYPE_BOOL, NULL, TRUE, 0 },
  134.     };
  135.  
  136. #define CURRENT_DESCRIPTOR descVer1
  137.  
  138. #define PBLOCK_LENGTH    7
  139.  
  140. #define CURRENT_VERSION    1
  141.  
  142. IObjParam *landscape::ip            = NULL;
  143. IParamMap *landscape::pmapParam    = NULL;
  144.  
  145. //--- landscape -------------------------------------------------------
  146.  
  147. landscape::landscape()
  148. {
  149.     strcpy(displacename,"None");
  150.     strcpy(colorname,"None");
  151.  
  152.     displacebmp=0;
  153.     colorbmp=0;
  154.  
  155.     pblock = CreateParameterBlock(
  156.                 CURRENT_DESCRIPTOR, 
  157.                 PBLOCK_LENGTH, 
  158.                 CURRENT_VERSION);
  159.     assert(pblock);
  160.     MakeRefByID(FOREVER, 0, pblock);
  161.     
  162.     pblock->SetValue(PB_SIZE,0, 0.0f);
  163.     pblock->SetValue(PB_SEGX,0, 16);
  164.     pblock->SetValue(PB_SEGY,0, 16);
  165.     pblock->SetValue(PB_DISPLACEVALUE,0, 10.0f);
  166.     pblock->SetValue(PB_MAPCOORD,0, 0);
  167.     pblock->SetValue(PB_MAPCOORDTILE,0, 4.0f);
  168.     pblock->SetValue(PB_COLORZGRAD,0, 0);
  169. }
  170.  
  171. landscape::~landscape()
  172. {
  173.     if (displacebmp)
  174.         displacebmp->DeleteThis();
  175.     if (colorbmp)
  176.         colorbmp->DeleteThis();
  177.     displacebmp=0;
  178.     colorbmp=0;
  179.     displacename[0]=0;
  180.     colorname[0]=0;
  181. }
  182.  
  183. #define DISPLACE_IMAGE_CHUNK 9110
  184. #define COLOR_IMAGE_CHUNK  9120
  185.  
  186. IOResult landscape::Load(ILoad *iload)
  187. {
  188.     ULONG nb;
  189.     IOResult res;
  190.     while (IO_OK==(res=iload->OpenChunk())) 
  191.     {
  192.         switch(iload->CurChunkID())  
  193.         {
  194.             case DISPLACE_IMAGE_CHUNK:
  195.                 res=iload->Read(displacename, iload->CurChunkLength(), &nb);
  196.                 break;
  197.             case COLOR_IMAGE_CHUNK:
  198.                 res=iload->Read(colorname, iload->CurChunkLength(), &nb);
  199.                 break;
  200.         }
  201.         iload->CloseChunk();
  202.         if (res!=IO_OK)
  203.             return res;
  204.     }
  205.     if (displacename[0])
  206.     {
  207.         BitmapInfo bi(displacename);
  208.         BMMRES status;
  209.         displacebmp=TheManager->Load(&bi,&status);
  210.         if (status!=BMMRES_SUCCESS)
  211.             displacename[0]=0;
  212.     }
  213.     if (colorname[0])
  214.     {
  215.         BitmapInfo bi(colorname);
  216.         BMMRES status;
  217.         colorbmp=TheManager->Load(&bi,&status);
  218.         if (status!=BMMRES_SUCCESS)
  219.             colorname[0]=0;
  220.     }
  221.     return IO_OK;
  222. }
  223.  
  224. IOResult landscape::Save(ISave *isave)
  225. {
  226.     ULONG nb;
  227.     
  228.     isave->BeginChunk(DISPLACE_IMAGE_CHUNK);
  229.     isave->Write(displacename, strlen(displacename)+1, &nb);
  230.     isave->EndChunk();
  231.  
  232.     isave->BeginChunk(COLOR_IMAGE_CHUNK);
  233.     isave->Write(colorname, strlen(colorname)+1, &nb);
  234.     isave->EndChunk();
  235.  
  236.     return IO_OK;
  237. }
  238.  
  239. class landscapeDlgProc : public ParamMapUserDlgProc {
  240.     public:
  241.         landscape *ls;
  242.         BOOL DlgProc(TimeValue t,IParamMap *map,HWND hWnd,UINT msg,WPARAM wParam,LPARAM lParam);
  243.         void DeleteThis() {}
  244.     };
  245.  
  246. static landscapeDlgProc landscapeProc;
  247.  
  248. BOOL landscapeDlgProc::DlgProc(
  249.         TimeValue t,IParamMap *map,
  250.         HWND hWnd,UINT msg,WPARAM wParam,LPARAM lParam)
  251. {
  252.     switch(msg)
  253.     {
  254.     case WM_COMMAND:
  255.         if (wParam==IDC_DISPLACEIMAGEBUT)
  256.         {
  257.             BitmapInfo bi;
  258.             if (ls->displacebmp)
  259.                 ls->displacebmp->DeleteThis();
  260.             ls->displacebmp=0;
  261.             strcpy(ls->displacename,"None");
  262.             if (TheManager->SelectFileInput(&bi,hWnd,"Select displace image"))
  263.                 {
  264.                 BMMRES status;
  265.                 ls->displacebmp=TheManager->Load(&bi,&status);
  266.                 if (status==BMMRES_SUCCESS)
  267.                     strcpy(ls->displacename,bi.Filename());
  268.                 }
  269.             SetDlgItemText(hWnd,IDC_DISPLACEIMAGEBUT,ls->displacename);
  270.             float size;
  271.             ls->pblock->GetValue(PB_SIZE,ls->ip->GetTime(),size,FOREVER);
  272.             ls->pblock->SetValue(PB_SIZE,0, size);
  273.         }
  274.         else if (wParam==IDC_TEXTUREIMAGEBUT)
  275.         {
  276.             BitmapInfo bi;
  277.             if (ls->colorbmp)
  278.                 ls->colorbmp->DeleteThis();
  279.             ls->colorbmp=0;
  280.             strcpy(ls->colorname,"None");
  281.             if (TheManager->SelectFileInput(&bi,hWnd,"Select texture image"))
  282.                 {
  283.                 BMMRES status;
  284.                 ls->colorbmp=TheManager->Load(&bi,&status);
  285.                 if (status==BMMRES_SUCCESS)
  286.                     strcpy(ls->colorname,bi.Filename());
  287.                 }
  288.             SetDlgItemText(hWnd,IDC_TEXTUREIMAGEBUT,ls->colorname);
  289.             float size;
  290.             ls->pblock->GetValue(PB_SIZE,ls->ip->GetTime(),size,FOREVER);
  291.             ls->pblock->SetValue(PB_SIZE,0, size);
  292.         }
  293.         break;
  294.     }
  295.     return FALSE;
  296. }
  297.  
  298. void landscape::BeginEditParams(IObjParam *ip,ULONG flags,Animatable *prev)
  299. {
  300.     this->ip = ip;
  301.     landscapeProc.ls=this;
  302.     SimpleObject::BeginEditParams(ip,flags,prev);
  303.  
  304.     if(pmapParam) {
  305.         pmapParam->SetParamBlock(pblock);
  306.     } else {
  307.         pmapParam = CreateCPParamMap(
  308.             descParam, PARAMDESC_LENGTH,
  309.             pblock, 
  310.             ip, 
  311.             hInstance, 
  312.             MAKEINTRESOURCE(IDD_PANEL),
  313.             GetString(IDS_PARAMS), 
  314.             0);
  315.     }
  316.     pmapParam->SetUserDlgProc(&landscapeProc);
  317.     
  318.     HWND hWnd=pmapParam->GetHWnd();
  319.     SetDlgItemText(hWnd,IDC_DISPLACEIMAGEBUT,displacename);
  320.     SetDlgItemText(hWnd,IDC_TEXTUREIMAGEBUT,colorname);
  321. }
  322.  
  323. void landscape::EndEditParams( IObjParam *ip, ULONG flags,Animatable *next )
  324. {
  325.     SimpleObject::EndEditParams(ip,flags,next);
  326.     if (flags&END_EDIT_REMOVEUI ) {
  327.         DestroyCPParamMap(pmapParam);
  328.         pmapParam  = NULL;
  329.     }
  330.     this->ip = NULL;
  331. }
  332.  
  333. BOOL landscape::HasUVW() 
  334.     BOOL mapcoord;
  335.     pblock->GetValue(PB_MAPCOORD,0,mapcoord,FOREVER);
  336.     return mapcoord; 
  337. }
  338.  
  339. void landscape::SetGenUVW(BOOL sw) 
  340. {  
  341.     if (sw==HasUVW()) return;
  342.     pblock->SetValue(PB_MAPCOORD,0, sw);
  343. }
  344.  
  345. class landscapeCreateCallBack : public CreateMouseCallBack {
  346.     IPoint2 sp0;        //First point in screen coordinates
  347.     landscape *ob;        //Pointer to the object 
  348.     Point3 p0;            //First point in world coordinates
  349. public:    
  350.     int proc( ViewExp *vpt,int msg, int point, int flags, IPoint2 m, Matrix3& mat);
  351.     void SetObj(landscape *obj) {ob = obj;}
  352. };
  353.  
  354. int landscapeCreateCallBack::proc(ViewExp *vpt,int msg, int point, int flags, IPoint2 m, Matrix3& mat )
  355. {
  356.     if (msg == MOUSE_FREEMOVE)
  357.         vpt->SnapPreview(m,m,NULL, SNAP_IN_3D);
  358.     else
  359.     if (msg==MOUSE_POINT)
  360.         {
  361.         if (point==0)
  362.             {
  363.             ob->suspendSnap = TRUE;
  364.             sp0 = m;
  365.             p0 = vpt->SnapPoint(m,m,NULL,SNAP_IN_PLANE);
  366.             mat.SetTrans(p0);
  367.             }
  368.         else 
  369.             {
  370.             ob->suspendSnap = FALSE;
  371.             return Length(sp0 - m)<3?CREATE_ABORT:CREATE_STOP;
  372.             }
  373.         }
  374.     else if (msg==MOUSE_MOVE) 
  375.         {
  376.         float size=Length(p0 - vpt->SnapPoint(m,m,NULL,SNAP_IN_PLANE));
  377.         ob->pblock->SetValue(PB_SIZE,0, size);
  378.         ob->pmapParam->Invalidate();
  379.         } 
  380.     else 
  381.         if (msg == MOUSE_ABORT) 
  382.             return CREATE_ABORT;
  383.  
  384.     return CREATE_CONTINUE;
  385. }
  386.  
  387. static landscapeCreateCallBack landscapeCreateCB;
  388.  
  389. CreateMouseCallBack* landscape::GetCreateMouseCallBack() 
  390. {
  391.     landscapeCreateCB.SetObj(this);
  392.     return(&landscapeCreateCB);
  393. }
  394.  
  395. void landscape::BuildMesh(TimeValue t)
  396. {
  397.     int nv,nf,ncvx,ncvy,x,y,i,segx,segy;
  398.     Point3 p;
  399.     float dx,dy,size,displacevalue,tile,maxdz=0;
  400.     BOOL mapcoord;
  401.     BOOL colorzgrad;
  402.     
  403.     ivalid = FOREVER;
  404.     pblock->GetValue(PB_SIZE,t,size,FOREVER);
  405.     pblock->GetValue(PB_SEGX,t,segx,FOREVER);
  406.     pblock->GetValue(PB_SEGY,t,segy,FOREVER);
  407.     pblock->GetValue(PB_DISPLACEVALUE,t,displacevalue,FOREVER);
  408.     pblock->GetValue(PB_MAPCOORD,t,mapcoord,FOREVER);
  409.     pblock->GetValue(PB_MAPCOORDTILE,t,tile,FOREVER);
  410.     pblock->GetValue(PB_COLORZGRAD,t,colorzgrad,FOREVER);
  411.     
  412.     ncvx=segx+1;
  413.     ncvy=segy+1;
  414.     nv=ncvx*ncvy;
  415.     nf=segx*2*segy;
  416.  
  417.     dx=size/(segx/2.0f);
  418.     dy=size/(segy/2.0f);
  419.  
  420.     mesh.setNumVerts(nv);
  421.     mesh.setNumFaces(nf);
  422.  
  423.     for( i=0,y=0;y<ncvy;y++ )
  424.         for( x=0;x<ncvx;x++,i++ )
  425.         {
  426.         p.x=-size+dx*x;
  427.         p.y=-size+dy*y;
  428.         p.z=0;
  429.         mesh.setVert(i,p);
  430.         }
  431.     for( i=0,y=0;y<segy;y++ )
  432.         for( x=0;x<segx;x++ )
  433.         {
  434.             mesh.faces[i].v[0]=y*ncvx+x;
  435.             mesh.faces[i].v[1]=y*ncvx+x+1;
  436.             mesh.faces[i].v[2]=(y+1)*ncvx+x;
  437.             mesh.faces[i].flags=EDGE_A|EDGE_C;
  438.             mesh.faces[i].smGroup=1;
  439.             i++;
  440.  
  441.             mesh.faces[i].v[0]=y*ncvx+x+1;
  442.             mesh.faces[i].v[1]=(y+1)*ncvx+x+1;
  443.             mesh.faces[i].v[2]=(y+1)*ncvx+x;
  444.             mesh.faces[i].flags=EDGE_A|EDGE_B;
  445.             mesh.faces[i].smGroup=1;
  446.             i++;
  447.         }
  448.     
  449.     if (displacebmp)
  450.     {
  451.     int wd,hd,c;
  452.     float dz;
  453.     wd=displacebmp->Width();
  454.     hd=displacebmp->Height();
  455.     BMM_Color_64 *ptr=new BMM_Color_64[wd]; 
  456.  
  457.     for( i=0,y=0;y<ncvy;y++ )
  458.         {
  459.         displacebmp->GetLinearPixels(0,y*(hd-1)/(ncvy-1),wd,ptr);
  460.         for( x=0;x<ncvx;x++,i++ )
  461.             {
  462.             c=  (int)ptr[x*(wd-1)/(ncvx-1)].r+
  463.                 (int)ptr[x*(wd-1)/(ncvx-1)].g+
  464.                 (int)ptr[x*(wd-1)/(ncvx-1)].b;
  465.             dz= displacevalue*(c/(float)0xffff);
  466.             mesh.verts[i].z+=dz;
  467.             if (dz>maxdz)
  468.                 maxdz=dz;
  469.             }
  470.         }
  471.  
  472.     delete ptr;
  473.     }
  474.  
  475.     if (colorbmp)
  476.     {
  477.     int wt,ht,c;
  478.     BMM_Color_64 *ptr=0;
  479.     wt=colorbmp->Width();
  480.     ht=colorbmp->Height();
  481.     ptr=new BMM_Color_64[wt];
  482.     
  483.     mesh.setNumVertCol(nv);
  484.     mesh.setNumVCFaces(nf);
  485.  
  486.     for( i=0;i<nf;i++ )
  487.         for( c=0;c<3;c++ )
  488.             mesh.vcFace[i].t[c]=mesh.faces[i].v[c];
  489.  
  490.     if (colorzgrad)
  491.         {
  492.             if (maxdz>0)
  493.             {
  494.             colorbmp->GetLinearPixels(0,0,wt,ptr);
  495.             for( i=0,y=0;y<ncvy;y++ )
  496.                 {
  497.                 for( x=0;x<ncvx;x++,i++ )
  498.                     {
  499.                     c=(int)(mesh.verts[i].z/maxdz*(ht-1));
  500.                     mesh.vertCol[i].x=(ptr[c].r/(float)0xffff);
  501.                     mesh.vertCol[i].y=(ptr[c].g/(float)0xffff);
  502.                     mesh.vertCol[i].z=(ptr[c].b/(float)0xffff);
  503.                     }
  504.                 }
  505.             }
  506.         }
  507.     else 
  508.         for( i=0,y=0;y<ncvy;y++ )
  509.             {
  510.             colorbmp->GetLinearPixels(0,y*(ht-1)/(ncvy-1),wt,ptr);
  511.             for( x=0;x<ncvx;x++,i++ )
  512.                 {
  513.                 mesh.vertCol[i].x=(ptr[x*(wt-1)/(ncvx-1)].r/(float)0xffff);
  514.                 mesh.vertCol[i].y=(ptr[x*(wt-1)/(ncvx-1)].g/(float)0xffff);
  515.                 mesh.vertCol[i].z=(ptr[x*(wt-1)/(ncvx-1)].b/(float)0xffff);
  516.                 }
  517.             }
  518.  
  519.     delete ptr;
  520.     }
  521.     else 
  522.     {
  523.     mesh.setNumVertCol(nv);
  524.     mesh.setNumVCFaces(nf);
  525.     int c;
  526.     for( i=0;i<nf;i++ )
  527.         for( c=0;c<3;c++ )
  528.             mesh.vcFace[i].t[c]=mesh.faces[i].v[c];
  529.     for( i=0;i<nv;i++ )
  530.         {
  531.         mesh.vertCol[i].x=1.0f;
  532.         mesh.vertCol[i].y=1.0f;
  533.         mesh.vertCol[i].z=1.0f;
  534.         }
  535.     }
  536.  
  537.     if (mapcoord)
  538.     {
  539.     mesh.setNumTVerts(nv);
  540.     mesh.setNumTVFaces(nf);
  541.     for( i=0,y=0;y<ncvy;y++ )
  542.         for( x=0;x<ncvx;x++,i++ )
  543.             mesh.setTVert(i,(float)x/ncvx*tile,(float)y/ncvy*tile,0);
  544.     for( i=0;i<nf;i++ )
  545.         for( x=0;x<3;x++ )
  546.             mesh.tvFace[i].t[x]=mesh.faces[i].v[x];
  547.     }
  548.  
  549.     mesh.InvalidateGeomCache();
  550.     mesh.InvalidateTopologyCache();
  551.     mesh.BuildStripsAndEdges();
  552. }
  553.  
  554. BOOL landscape::OKtoDisplay(TimeValue t) 
  555. {
  556.     float size;
  557.     pblock->GetValue(PB_SIZE,t,size,FOREVER);
  558.     if (size==0.0f) return FALSE;
  559.     else return TRUE;
  560. }
  561.  
  562. void landscape::InvalidateUI() 
  563. {
  564.     if (pmapParam) pmapParam->Invalidate();
  565. }
  566.  
  567. ParamDimension *landscape::GetParameterDim(int pbIndex) 
  568. {
  569.     return defaultDim;
  570. }
  571.  
  572. TSTR landscape::GetParameterName(int pbIndex) 
  573. {
  574.     return GetString(IDS_PARAMS);
  575. }
  576.  
  577. BOOL landscape::SetValue(int i, TimeValue t, int v) 
  578. {
  579.     return TRUE;
  580. }
  581.  
  582. BOOL landscape::SetValue(int i, TimeValue t, float v)
  583. {
  584.     return TRUE;
  585. }
  586.  
  587. BOOL landscape::SetValue(int i, TimeValue t, Point3 &v) 
  588. {
  589.     return TRUE;
  590. }
  591.  
  592. BOOL landscape::GetValue(int i, TimeValue t, int &v, Interval &ivalid) 
  593. {
  594.     return TRUE;
  595. }
  596.  
  597. BOOL landscape::GetValue(int i, TimeValue t, float &v, Interval &ivalid) 
  598. {
  599.     return TRUE;
  600. }
  601.  
  602. BOOL landscape::GetValue(int i, TimeValue t, Point3 &v, Interval &ivalid) 
  603. {    
  604.     return TRUE;
  605. }
  606.  
  607. Object* landscape::ConvertToType(TimeValue t, Class_ID obtype)
  608. {
  609.     return SimpleObject::ConvertToType(t,obtype);
  610. }
  611.  
  612. int landscape::CanConvertToType(Class_ID obtype)
  613. {
  614.     if (obtype==defObjectClassID ||
  615.         obtype==triObjectClassID) {
  616.         return 1;
  617.     } else {        
  618.     return SimpleObject::CanConvertToType(obtype);
  619.         }
  620. }
  621.  
  622. int landscape::IntersectRay(
  623.         TimeValue t, Ray& ray, float& at, Point3& norm)
  624. {
  625.     return SimpleObject::IntersectRay(t,ray,at,norm);
  626. }
  627.  
  628. void landscape::GetCollapseTypes(Tab<Class_ID> &clist,Tab<TSTR*> &nlist)
  629. {
  630.     Object::GetCollapseTypes(clist, nlist);
  631. }
  632.  
  633. RefTargetHandle landscape::Clone(RemapDir& remap) 
  634. {
  635.     landscape* newob = new landscape();    
  636.     newob->ReplaceReference(0,pblock->Clone(remap));
  637.     newob->ivalid.SetEmpty();
  638.     return(newob);
  639. }
  640.